Hi there, |
Re: DOORS DXL - Comparing In-links with enumerated attributes
Hey John,
Module m = current
Object o = object(62)
string attribute
string srcModName = ""
LinkRef lref
for lref in o <- "*" do
{
srcModName = fullName source (lref)
}
attribute = o."Attribute Name"
print "srcModName: " srcModName "\n"
print "attribute: " attribute "\n"
if (srcModName == attribute)
{
// do something here
}
|
Re: DOORS DXL - Comparing In-links with enumerated attributes This may help. Lets assume your enumerated values are the base name of the Allocated-to modules.
string Allocated = obj."Allocated"
Skip skpAllocated = createString()
string Value, NameMod
Link lnk
// Get list of all allocated modules. They are separated by EOls
bool Done = false
int Length = length(Allocated)
int PosNew = -1
int PosOld = -1
while(!Done)
{ PosNew++
if (Allocated[PosNew] == '\n')
{ // Found another entry
if (PosOld >= Length) Done = true
elseif (PosOld+1 == PosNew){} // empty string, do nothing
else
{ Value = Allocated[PosOld+1:PosNew-1]
put(skpAllocated, Value, Value)
}
PosOld = PosNew
}
}
// Get the last value, if any
if (PosOld+1 == PosNew){} // EmptString, do nothing
else
{ Value = Allocated[PosOld+1:] // rest of the string
put(skpAllocated, Value, Value)
}
// OK, now we have a Skip list of selected values
for lnk in obj <- "*" do
{ NameMod = name(target(lnk))
if (find(skpAllocated, NameMod))
{ // Incoming link from a module to which we allocated
delete(skpAllocated, Value) // perhaps delete the value from the Skip
}
else
{ // Incoming link from a module we did not allocate, or a 2nd such link
}
}
for Value in skpAllocated do
{ report Value is allocated, but has no incoming link
}
delete(skpAllocated)
|
Re: DOORS DXL - Comparing In-links with enumerated attributes ManuelFelger - Mon Dec 14 09:49:25 EST 2009
Hey John,
Module m = current
Object o = object(62)
string attribute
string srcModName = ""
LinkRef lref
for lref in o <- "*" do
{
srcModName = fullName source (lref)
}
attribute = o."Attribute Name"
print "srcModName: " srcModName "\n"
print "attribute: " attribute "\n"
if (srcModName == attribute)
{
// do something here
}
Thanks for the help. The only problem is that I think this code may be good for only one source module. But I have over 30 source modules (all located in one folder incidentally). Does the (string srcModName = "") part mean any source module or am I supposed to name a single module in the quotes? Is it possible to put a folder path in here or wildcard? The code above, matches a non named enumerated attribute value (i.e. blank) with an object that doesnt have any links, which makes sense since there is nothing in the quotes above. BTW, thanks for the speedy responses. |
Re: DOORS DXL - Comparing In-links with enumerated attributes jmcgown - Tue Dec 15 08:50:35 EST 2009 i.e. if all enumerated attribute values in an object have at least one link to the specified module. Thanks, John |
Re: DOORS DXL - Comparing In-links with enumerated attributes jmcgown - Tue Dec 15 08:50:35 EST 2009 The "*" part of the link loop means "any link module", which means the link finds the links. Once he has a link he gets the source module name. He should print it inside the loop, not outside. If you want to restrict found links to a specific source module, perhaps basname "abc", then you get the name(source(link)) and continue if its not "abc".
|